# Contributor: qaqland <qaq@qaq.land>
# Maintainer: qaqland <qaq@qaq.land>
pkgname=libsv
pkgver=1.2
pkgrel=0
pkgdesc="Public domain cross-platform semantic versioning in c99"
url="https://github.com/uael/sv"
arch="all"
license="Unlicense"
makedepends="cmake samurai"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/uael/sv/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/sv-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
9dd3747a8db2eb3852e01086ec5e1f7652e836f5e5e0cd3d593ce3afed9ef86b161e0b476d156fb298d66172d579e246863d76fc639aef48657b0e5547c52b4d  libsv-1.2.tar.gz
"
